SUBDIRS = src doc
SRCDIST_TMPDIR = ..
SRCDIST_TARDIR = $(PACKAGE)-$(VERSION)
SRCDIST_PATH = $(SRCDIST_TMPDIR)/$(SRCDIST_TARDIR)

src-dist: distclean emacs-clean
	echo "Using $(SRCDIST_PATH) to tar up src-dist."
	test -e $(SRCDIST_PATH) || mkdir $(SRCDIST_PATH)
	rm -rf $(SRCDIST_PATH)/*
	find . ! -name "Makefile" -name ".cvsignore" \
		! -name "requests" ! -name "output.0" ! -name "traces.0" \
		| grep -v "CVS" \
		| grep -v ".deps" \
		| cpio -pmduv $(SRCDIST_PATH)
	cd $(SRCDIST_TMPDIR) && tar cvf - $(SRCDIST_TARDIR) \
		| gzip -c > $(SRCDIST_TARDIR).tgz
	echo "Tar gz file is here: $(SRCDIST_PATH).tgz"
	rm -rf $(SRCDIST_PATH)

emacs-clean:
	find . -name "*~" -exec rm -rf {} \;

serial-reset:
	echo "0" > build/serial

safe-commit:
	cvs commit src/c/include/ath*.h src/c/util/*.c src/c/cmd/*.c \
		src/c/lb/*.c src/c/module/*.c src/sh/*.sh src/perl/package/Athena \
		configure.in build/ath_common.m4 bootstrap doc/css/*.css \
		doc/html/*.html doc/images/*
